#pragma once

#include "../umlmodel_global.h"

#include <memory>
#include <vector>

#include "Action.h"

using std::make_shared;
using std::shared_ptr;
using std::vector;

namespace uml {
class InputPin;
class Port;

/// <summary>
/// InvocationAction
/// InvocationAction is an abstract class for the various actions that request
/// Behavior invocation.
/// 
/// </summary>
class UMLMODEL_EXPORT InvocationAction : public Action {

public: // Constructors and destructors
    explicit InvocationAction(const QString& umlType="uml::InvocationAction");

public: // JsonSerializable override
    void fromJson(const QJsonObject& json, QStringList& errorList) override;
    void toJson(QJsonObject& json) override;

public: // Properties
    /// <summary>
    /// arguments getter
    /// The InputPins that provide the argument values passed in the invocation request.
    /// </summary>
    vector<shared_ptr<InputPin>>& arguments();

    /// <summary>
    /// onPort getter
    /// For CallOperationActions, SendSignalActions, and SendObjectActions, an optional
    /// Port of the target object through which the invocation request is sent.
    /// </summary>
    shared_ptr<Port> onPort() const;

    /// <summary>
    /// onPort setter
    /// For CallOperationActions, SendSignalActions, and SendObjectActions, an optional
    /// Port of the target object through which the invocation request is sent.
    /// </summary>
    void setOnPort(shared_ptr<Port> value);

private: // Fields
    /// <summary>
    /// arguments
    /// The InputPins that provide the argument values passed in the invocation request.
    /// </summary>
    vector<shared_ptr<InputPin>> arguments_;

    /// <summary>
    /// onPort
    /// For CallOperationActions, SendSignalActions, and SendObjectActions, an optional
    /// Port of the target object through which the invocation request is sent.
    /// </summary>
    shared_ptr<Port> onPort_;

};

} // namespace uml
